/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.crm.store;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N850;
import queenb.net.entitybean.N900;
import queenb.web.crm.inteface.N900Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class N900Store extends N900 implements  N900Inf{

    @Override
    public List<N900> getFindN900ByCombN850(int pnFH000, int pnFH200, int pnFN850, String pvLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_COMBTABN900, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnFH000),
                       new Param(OracleTypes.INTEGER, pnFH200),
                       new Param(OracleTypes.INTEGER, pnFN850),
                       new Param(OracleTypes.CHAR, pvLogin)
                   });
           return super.find(dataStatement, N900.class);
        } catch (SQLException ex) {
            Logger.getLogger(N850Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N850Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N850Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public List<N900> getFindN900ByListN850(int pnFH000, int pnFH200, int pnFN850, String pvLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N900_N850_R, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnFH000),
                       new Param(OracleTypes.INTEGER, pnFH200),
                       new Param(OracleTypes.INTEGER, pnFN850),
                       new Param(OracleTypes.CHAR, pvLogin)
                   });
           return super.find(dataStatement, N900.class);
        } catch (SQLException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public List<N900> getFindN900NoGroup(int pnFH000, int pnFH200, int pnFN850, String pvLogin) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N900_N850_L, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnFH000),
                       new Param(OracleTypes.INTEGER, pnFH200),
                       new Param(OracleTypes.INTEGER, pnFN850),
                       new Param(OracleTypes.CHAR, pvLogin)
                   });
           return super.find(dataStatement, N900.class);
        } catch (SQLException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int deleteN900(int pnFN100, int pnFN850, String pvLOGIN) {
         DataStatement deleteN900Statement = new DataStatement(PackageContants.DELETE_N900, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.INTEGER, pnFN850),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.update(deleteN900Statement, null);
        } catch (SQLException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int updateN900(int pnFN100, int pnFN850, String pvNV901, String pvNV902, String pvNV903, String pvNV904, String pvLOGIN) {
        DataStatement updateN900Statement = new DataStatement(PackageContants.UPDATE_N900, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.INTEGER, pnFN850),
                    new Param(OracleTypes.CHAR, pvNV901),
                    new Param(OracleTypes.CHAR, pvNV902),
                    new Param(OracleTypes.CHAR, pvNV903),
                    new Param(OracleTypes.CHAR, pvNV904),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(updateN900Statement, null);
        } catch (SQLException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return  0;
        }
    }

    @Override
    public int updateN300(int pnFN100, int pnFN850, String pvNV852, String pvNV302, Date pdND304, Date pdND305, String pvLOGIN) {
        DataStatement updateN900Statement = new DataStatement(PackageContants.UPDATE_N300, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.INTEGER, pnFN850),
                    new Param(OracleTypes.CHAR, pvNV852),
                    new Param(OracleTypes.CHAR, pvNV302),
                    new Param(OracleTypes.DATE, pdND304),
                    new Param(OracleTypes.DATE, pdND305),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(updateN900Statement, null);
        } catch (SQLException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return  0;
        }
    }

    @Override
    public List<N900> getEmpInGroup(int pnFH000, int pnFH200, int pnFN850, String pvLOGIN) {
       try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N900G, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnFH000),
                       new Param(OracleTypes.INTEGER, pnFH200),
                       new Param(OracleTypes.INTEGER, pnFN850),
                       new Param(OracleTypes.CHAR, pvLOGIN)
                   });
           return super.find(dataStatement, N900.class);
        } catch (SQLException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N900Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
}
